Could not read module ..

Dear all,

 

Could you please tell me what is the problem with this code ? I wanted to retrieve the number of outlinks in all the modules recursively under a folder path . i Could able to print the module name , but the could not able to assign those values to the module m . Please help. Thanks!

 

pragma runLim, 0
 
void modulelist(Folder f)
{
Item i
for i in all f do {
 
if (type(i) == "Folder") 
{
modulelist(folder(i)) 
 
}
 
else if((type (i)=="Formal") && (!isDeleted(i)))
{
string s= name i 
Module m 
m=read(s,false)
 
Object o =null
Link l = null
LinkRef lr = null
int outlink=0
ModName_ mn = null
string linkModuleName1 ="/BCD"
string s1
 
print s "\n" ""
print m "\n" ""
 
for o in m do
{
s1 =o."Allotion"
 
 
if (s1=="porp") {
 
for l in o -> linkModuleName1 do
{
mn = target(l)
outlink++
}
}
 
}
print "The number of outlinks to" name(m) " are " outlink "\n"
}
}
}
modulelist(folder "/ABC")

doors@36677 - Wed May 09 05:49:48 EDT 2018

Re: Could not read module ..
doors@36677 - Wed May 09 08:21:48 EDT 2018

hi guys,

 

any response on the above ... please help

Re: Could not read module ..
PMiller - Wed May 09 19:10:29 EDT 2018

doors@36677 - Wed May 09 08:21:48 EDT 2018

hi guys,

 

any response on the above ... please help

Hi,

From your description "...Could able to print the module name.... " I assume that your code is getting as far as the two print commands:

print s "\n" ""

print m "\n" ""

If this is correct, then have a closer look at the conditional statement if (s1=="porp").

Are you sure that "porp" is correct and that a spelling mistake has not been made?

 

Also, I have a question about the following code line: 

print "The number of outlinks to" name(m) " are " outlink "\n"

This will print the name of the currently open module "m" and not the name of the target module "mn" at the other end of the outgoing links. Should  name(m)  be  name(mn)?

 

Paul Miller
Melbourne, Australia

 

Re: Could not read module ..
doors@36677 - Thu May 10 00:20:16 EDT 2018

PMiller - Wed May 09 19:10:29 EDT 2018

Hi,

From your description "...Could able to print the module name.... " I assume that your code is getting as far as the two print commands:

print s "\n" ""

print m "\n" ""

If this is correct, then have a closer look at the conditional statement if (s1=="porp").

Are you sure that "porp" is correct and that a spelling mistake has not been made?

 

Also, I have a question about the following code line: 

print "The number of outlinks to" name(m) " are " outlink "\n"

This will print the name of the currently open module "m" and not the name of the target module "mn" at the other end of the outgoing links. Should  name(m)  be  name(mn)?

 

Paul Miller
Melbourne, Australia

 

Hi Miller,

I found the problem , i am not assigning the module as current .. rest all code is fine , thanks for the response !